package com.xuzong.util;

import cn.hutool.socket.protocol.MsgDecoder;
import lombok.Data;

import java.io.Serializable;

@Data
public class R implements Serializable {


    private String msg = "操作成功!";

    private Integer code = 200;

    private Boolean flag = true;

    private Object data = null;


    public static R ok(){
        R r = new R();
        return r;
    }

    public static R ok(Object data){
        R r = new R();
        r.setData(data);
        return r;
    }

    public static R error(Integer code, String msg){
        R r = new R();
        r.setFlag(false);
        r.setMsg(msg);
        r.setCode(code);
        return r;
    }


}
